namespace KinonekoSoftware.CodariaDB.Documents.Composites
{
    public sealed partial class CompositeEngine : Engine
    {

        protected override void OnDatabaseOpening(RepositoryOpenContext context)
        {
            var repo = context.Repository;

            BirthdayDB      = repo.Get<Birthday>(CollectionNames.BirthdayDB);
            EvaluationDB    = repo.Get<Evaluation>(CollectionNames.EvaluationDB);
            SentenceDB      = repo.Get<Sentence>(CollectionNames.SentenceDB);
            AbilityBundleDB = repo.Get<AbilityBundle>(CollectionNames.AbilityBundleDB);

        }

        protected override void OnDatabaseClosing(ILogger logger)
        {
            BirthdayDB      = null;
            EvaluationDB    = null;
            SentenceDB      = null;
            AbilityBundleDB = null;
        }


        public ILiteCollection<Birthday>      BirthdayDB      { get; private set; }
        public ILiteCollection<Evaluation>    EvaluationDB    { get; private set; }
        public ILiteCollection<Sentence>      SentenceDB      { get; private set; }
        public ILiteCollection<AbilityBundle> AbilityBundleDB { get; private set; }

        public override string EngineID => EngineNames.Composite;
    }
}